package com.shopping.user.controller;

import com.shopping.entity.Result;
import com.shopping.entity.StatusCode;
import com.shopping.user.pojo.BookMark;
import com.shopping.user.service.BookMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 店铺收藏接口
 * @author liaokang
 * @version 1.0
 * @date 2020/6/4 14:19
 */
@RestController
@RequestMapping("/bookmark")
public class BookMarkController {

    @Autowired
    private BookMarkService bookMarkService;

    @GetMapping("/{u_id}")
    public Result<List<BookMark>> findBookMarkByU_id(@PathVariable int u_id){
        return new Result<>(true, StatusCode.OK,"查询成功",bookMarkService.findBookMarkByU_id(u_id));
    }


    @DeleteMapping("/{s_id}")
    public Result delBookMarkByU_id(@PathVariable int s_id){
        bookMarkService.delBookMarkByU_id(s_id);
        return new Result(true,StatusCode.OK,"取消收藏成功");
    }

    

}
